/**
 **LocalCache class will read data of xml file into memory when plugin first was loaded in browser,
 **so only update m_dataMap that is memory data. when plugin upload, write into xml file. 
 **/
#pragma once
#include "B5M_Singleton.h"

#include <map>
#include <string>
using namespace std;


class CLocalCache
{
    friend class B5M_Singleton<CLocalCache>;

public:
	bool InitCache();
	bool CreateCacheFile(const string& filePath);
	bool UpdateCacheItem(const string& key, const string& value);
	string GetValueByKey(const string& key);

private:
    CLocalCache();
    ~CLocalCache();

	bool SaveCacheFile();

private:
	map<string, string>    m_mapData;
    bool                   m_bCreate;                    // create successfull or failed
};

#define sgtLocalCache   B5M_Singleton<CLocalCache>